package org.note.law.module.provision;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.lboot.jpa.jpa.AbstractJpaCurdExt;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
@AllArgsConstructor
public class LawProvisionServiceImpl  extends AbstractJpaCurdExt<String, LawProvision, LawProvisionDAO> implements LawProvisionService{
    @Override
    public List<LawProvision> getByCodeId(String codeId) {
        return dao.findByCodeId(codeId);
    }

    @Override
    public List<LawProvision> deleteByCodeId(String codeId) {
        List<LawProvision> provisions = dao.findByCodeId(codeId);
        dao.deleteAllInBatch(provisions);
        return provisions;
    }
}
